package com.ouman.luoliluoli;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.ouman.luoliluoli.utils.ThemeChanger;

public class HotGirlsDetailActivity extends AppCompatActivity {

    private int likeCount;
    private int downloadCount;
    private String imageUrl;
    private String title;

    private TextView textViewTitle;
    private TextView textViewLikeCount;
    private TextView textViewDownloadCount;
    private ImageView imageViewHotGirl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ThemeChanger.applyTheme(this, null);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hot_girls_detail);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolBarHotGirlsDetail);
        toolbar.setTitle("");
        setSupportActionBar(toolbar);
        if (getSupportActionBar() != null){
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }

        imageViewHotGirl = (ImageView) findViewById(R.id.imageViewHotGirl);
        textViewTitle = (TextView) findViewById(R.id.textViewTitle);
        textViewLikeCount = (TextView) findViewById(R.id.textViewLike);
        textViewDownloadCount = (TextView) findViewById(R.id.textViewDownloads);

        Bundle bundle = this.getIntent().getExtras();
        imageUrl = bundle.getString("imageUrl");
        title = bundle.getString("title");
        likeCount = bundle.getInt("likeCount");
        downloadCount = bundle.getInt("downloadCount");

        Glide.clear(imageViewHotGirl);
        Glide.with(HotGirlsDetailActivity.this)
                .load(imageUrl)
                .asBitmap()
                .error(R.drawable.bk_beauty)
                .into(imageViewHotGirl);

        textViewTitle.setText(title);
        textViewLikeCount.setText(String.valueOf(likeCount));
        textViewDownloadCount.setText(String.valueOf(downloadCount));


        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "HOT GIRL已经保存到了本地", Snackbar.LENGTH_LONG)
                        .setAction("撤销", new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {

                            }
                        }).show();
            }
        });
    }

}
